package com.example.lombok;

import lombok.Cleanup;
import lombok.SneakyThrows;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringBufferInputStream;

/**
 * @author shanchong
 * @date 2019-06-23
 **/
public class SneakyThrowsDemo {

    /**
     * @SneakyThrows：自动抛受检异常，而无需显式在方法上使用throws语句
     * @param args
     */
    @SneakyThrows
    public static void main(String[] args) {
        StringBufferInputStream inputStream = new StringBufferInputStream("111111");
        @Cleanup InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
        System.out.println(inputStreamReader);
    }

}
